package com.liuh.edu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.liuh.edu.mapper.ClassRoomMapper;
import com.liuh.edu.pojo.ClassRoom;
import com.liuh.edu.service.IClassRoomService;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liuh
 * @since 2018-06-21
 */
@Service
public class ClassRoomServiceImpl extends ServiceImpl<ClassRoomMapper, ClassRoom> implements IClassRoomService {
	
	@Autowired
	ClassRoomMapper roomMapper;

	@Override
	public int countRoom() {
		// TODO Auto-generated method stub
		return roomMapper.countRoom();
	}

	@Override
	public int insertRoom(ClassRoom room) {
		room.insert();
		if(room.getCrName().equals("5-55")) {
			throw new RuntimeException("手动抛出异常");
		}
		return 0;
	}

	@Override
	public List<ClassRoom> selectMyPage() {
		// TODO Auto-generated method stub
		EntityWrapper<ClassRoom> ew = new EntityWrapper<ClassRoom>();
		ew.eq("cr_name", "5-55");
		roomMapper.selectMyPage(ew);
		return null;
	}

	@Override
	public List<ClassRoom> selectMyPage2(String crName) {
		// TODO Auto-generated method stub
		roomMapper.selectMyPage2(crName);
		return null;
	}

	@Override
	public void deleteRoom() {
		// TODO Auto-generated method stub
		roomMapper.deleteAll();
	}

}
